package com.gzwh.v1.sysapi.dao.application;

import com.gzwh.v1.sysapi.entity.application.SysAppReg;
import com.gzwh.v1.sysapi.entity.application.SystemApplication;
import com.gzwh.v1.sysapi.entity.application.UserApplication;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface SysAppRegMapper {

    //返回该用户和该菜单下的id为多少
    @Select("select COUNT(*) AS count FROM `sf_app_reg` WHERE `aid`=#{aid}  and `uid`=#{uid} ")
    int getUidAndAidToCount(Long aid, Long uid);

    @Select("Select * from sf_user_application where uid=#{uid}")
    UserApplication findUserAppByuid(Long uid);

    @Select("select * from sf_app_description where id=#{id}")
    SystemApplication findUserApplicationByid(Long id);

    int insetTo(SysAppReg sysAppReg);

    @Select("select count(*)  from  sf_app_reg  t1, sf_app_description  t2  where t1.`id` =#{appId} and  t1.`uid` =#{userId} and t1.`aid` =t2.`id`  and t2.`inside` ='dinner' ")
    int getDinnerVerByAppctionId(@Param("appId") Long appid,@Param("userId") Long userId);
}
